# eric7.WebBrowser.History.HistoryManager

Module implementing the history manager.

### Global Attributes

HISTORY_VERSIONS
HISTORY_VERSION_42
HISTORY_VERSION_60

### Classes

HistoryEntry | Class implementing a history entry.
HistoryManager | Class implementing the history manager.

### Functions

None

## HistoryEntry

Class implementing a history entry.

### Derived from

None

### Class Attributes

None

### Class Methods

None

### Methods

HistoryEntry | Constructor
__eq__ | Special method determining equality.
__lt__ | Special method determining less relation.
isValid | Public method to determine validity.
userTitle | Public method to get the title of the history entry.

### Static Methods

None

#### HistoryEntry (Constructor)

HistoryEntry(url=None, dateTime=None, title=None, visitCount=None)

Constructor

url (str)
  URL of the history entry
dateTime (QDateTime)
  date and time this entry was created
title (str)
  title string for the history entry
visitCount (int)
  number of visits of this URL

#### HistoryEntry.__eq__

__eq__(other)

Special method determining equality.

other (HistoryEntry)
  reference to the history entry to compare against

Return:
  flag indicating equality

Return Type:
  bool

#### HistoryEntry.__lt__

__lt__(other)

Special method determining less relation.

Note: History is sorted in reverse order by date and time

other (HistoryEntry)
  reference to the history entry to compare against

Return:
  flag indicating less

Return Type:
  bool

#### HistoryEntry.isValid

isValid()

Public method to determine validity.

Return:
  flag indicating validity

Return Type:
  bool

#### HistoryEntry.userTitle

userTitle()

Public method to get the title of the history entry.

Return:
  title of the entry

Return Type:
  str

Up

## HistoryManager

Class implementing the history manager.

### Signals

entryAdded(HistoryEntry)
  emitted after a history entry has been added
entryRemoved(HistoryEntry)
  emitted after a history entry has been removed
entryUpdated(int)
  emitted after a history entry has been updated
historyCleared()
  emitted after the history has been cleared
historyReset()
  emitted after the history has been reset
historySaved()
  emitted after the history was saved

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

HistoryManager | Constructor
__checkForExpired | Private slot to check entries for expiration.
__cleanUrl | Private method to generate a clean URL usable for the history entry.
__cleanUrlStr | Private method to generate a clean URL usable for the history entry.
__findFirstHistoryEntry | Private method to find the first entry for the given URL.
__load | Private method to load the saved history entries from disk.
__refreshFrequencies | Private slot to recalculate the refresh frequencies.
__startFrequencyTimer | Private method to start the timer to recalculate the frequencies.
__updateVisitCount | Private method to update the visit count for all entries of the given URL.
addHistoryEntry | Public method to add a history entry.
clear | Public slot to clear the complete history.
close | Public method to close the history manager.
daysToExpire | Public method to get the days for entry expiration.
getFileName | Public method to get the file name of the history file.
history | Public method to return the history.
historyFilterModel | Public method to get a reference to the history filter model.
historyModel | Public method to get a reference to the history model.
historyTreeModel | Public method to get a reference to the history tree model.
preferencesChanged | Public method to indicate a change of preferences.
reload | Public method to reload the history.
removeHistoryEntry | Public method to remove a history entry.
save | Public slot to save the history entries to disk.
setDaysToExpire | Public method to set the days for entry expiration.
setHistory | Public method to set a new history.
siteVisitsCount | Public method to get the visit count for a web site using the given scheme.
updateHistoryEntry | Public method to update a history entry.

### Static Methods

None

#### HistoryManager (Constructor)

HistoryManager(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### HistoryManager.__checkForExpired

__checkForExpired()

Private slot to check entries for expiration.

#### HistoryManager.__cleanUrl

__cleanUrl(url)

Private method to generate a clean URL usable for the history entry.

url (QUrl)
  original URL

Return:
  cleaned URL

Return Type:
  QUrl

#### HistoryManager.__cleanUrlStr

__cleanUrlStr(url)

Private method to generate a clean URL usable for the history entry.

url (QUrl)
  original URL

Return:
  cleaned URL

Return Type:
  str

#### HistoryManager.__findFirstHistoryEntry

__findFirstHistoryEntry(url)

Private method to find the first entry for the given URL.

url (str)
  URL to search for

Return:
  first entry for the given URL

Return Type:
  HistoryEntry

#### HistoryManager.__load

__load()

Private method to load the saved history entries from disk.

#### HistoryManager.__refreshFrequencies

__refreshFrequencies()

Private slot to recalculate the refresh frequencies.

#### HistoryManager.__startFrequencyTimer

__startFrequencyTimer()

Private method to start the timer to recalculate the frequencies.

#### HistoryManager.__updateVisitCount

__updateVisitCount(url, count)

Private method to update the visit count for all entries of the given URL.

url (str)
  URL to be updated
count (int)
  new visit count

#### HistoryManager.addHistoryEntry

addHistoryEntry(view)

Public method to add a history entry.

view (WebBrowserView)
  reference to the view to add an entry for

#### HistoryManager.clear

clear(period=0)

Public slot to clear the complete history.

period (int)
  history period in milliseconds to be cleared

#### HistoryManager.close

close()

Public method to close the history manager.

#### HistoryManager.daysToExpire

daysToExpire()

Public method to get the days for entry expiration.

Return:
  days for entry expiration

Return Type:
  int

#### HistoryManager.getFileName

getFileName()

Public method to get the file name of the history file.

Return:
  name of the history file

Return Type:
  str

#### HistoryManager.history

history()

Public method to return the history.

Return:
  reference to the list of history entries

Return Type:
  list of HistoryEntry

#### HistoryManager.historyFilterModel

historyFilterModel()

Public method to get a reference to the history filter model.

Return:
  reference to the history filter model

Return Type:
  HistoryFilterModel

#### HistoryManager.historyModel

historyModel()

Public method to get a reference to the history model.

Return:
  reference to the history model

Return Type:
  HistoryModel

#### HistoryManager.historyTreeModel

historyTreeModel()

Public method to get a reference to the history tree model.

Return:
  reference to the history tree model

Return Type:
  HistoryTreeModel

#### HistoryManager.preferencesChanged

preferencesChanged()

Public method to indicate a change of preferences.

#### HistoryManager.reload

reload()

Public method to reload the history.

#### HistoryManager.removeHistoryEntry

removeHistoryEntry(url, title="")

Public method to remove a history entry.

url (QUrl)
  URL of the entry to remove
title (str)
  title of the entry to remove

#### HistoryManager.save

save()

Public slot to save the history entries to disk.

#### HistoryManager.setDaysToExpire

setDaysToExpire(limit)

Public method to set the days for entry expiration.

limit (int)
  days for entry expiration

#### HistoryManager.setHistory

setHistory(history, loadedAndSorted=False)

Public method to set a new history.

history (list of HistoryEntry)
  reference to the list of history entries to be set
loadedAndSorted (bool)
  flag indicating that the list is sorted

#### HistoryManager.siteVisitsCount

siteVisitsCount(scheme, host)

Public method to get the visit count for a web site using the given scheme.

scheme (str)
  scheme to look for
host (str)
  host to look for

Return:
  number of visits to this site

Return Type:
  int

#### HistoryManager.updateHistoryEntry

updateHistoryEntry(url, title)

Public method to update a history entry.

url (str)
  URL of the entry to update
title (str)
  title of the entry to update

Up